StringFunctions.Regex substring function

Extracts a substring from the given string using regular epxression pattern matching

Format

ANSI-SQL Format:

SUBSTRING_REGEX ( Pattern [ FLAG Option ] IN Subject [ FROM Offset ] [ OCCURRENCE Occurence ] )

Remarks

The SUBSTRING_REGEX scalar function extracts a substring from a given string using regular expression matching. Pattern is the regular expression string to search for. For more information on regular expression patterns, refer to Regular Expressions.

If specified, the Option argument changes the pattern matching behavior. For more information on regular expression options refer to Regular Expression Option Flags

Subject is the string to be searched.

If specified, the Start argument is the 1-based offset into Subject to start the search. If Start is less than 1 or greater than the length of Subject, the function returns NULL. If Start is not specified, the starting position is assumed to be 1, which is the first character in Subject

If specified, the Occurrence argument defines which occurrence of the Pattern to return. If Occurrence is 1, the 1st occurrence of the Pattern is returned. If Occurrence is 2, the 2nd occurrence of the Pattern is returned. If Occurrence is less than 1 or greater than the number of occurrences of Pattern, the function returns NULL. If Occurrence is not specified, the value 1 is assumed, which returns the first occurrence.

If you reference system status tags in your ST programs, you need to prefix the names of those system status tags with an additional caret '^' escape character. This escapes the reserved caret '^' character that is used at the start of the names of system status tags (also known as 'status attributes') (see Access System Status Information).

For example:

VAR

sServerStateTime AT %M(^^<server name>.ServerStateTime): DATE_AND_TIME;

END_VAR


Disclaimer

Geo SCADA Expert 2019